package nii.game.mobileserio.sound;

import java.io.IOException;

import org.anddev.andengine.audio.sound.Sound;
import org.anddev.andengine.audio.sound.SoundFactory;
import org.anddev.andengine.engine.Engine;
import org.anddev.andengine.util.Debug;

import android.content.Context;

public class SoundEffect {

	private Sound soundEff;
	private String filename;
	
	public SoundEffect(String _filename){
		filename = _filename;
	}
	//============================|| HÀM LOAD ÂM THANH HIỆU ỨNG||=============================//
	public void onLoadResources(Engine mEngine, Context mContext) {

		// Đường dẫn đến thư mục chưa file audio
		SoundFactory.setAssetBasePath("mfx/");
		try{
			soundEff = SoundFactory.createSoundFromAsset(mEngine.getSoundManager(), mContext, filename);
			//soundEff.setLooping(true);
		} catch (final IOException e){
			Debug.e(e);
		}
	}
	
	// Hàm PLAY
	public void Play(){
		soundEff.play();
			
	}
	
}
